function checkout(way){
    window.location.href='order.do?operate=checkout&way='+way;
}

window.onload=function (){
    var vue = new Vue({
        el:"#cart_div",
        data:{
            cart:{},

        },
        methods:{
        getCart:function (){
            axios({
                method:"POST",
                url:"cart.do",
                params:{
                    operate:'cartInfo'
                }
            })
                .then(function (value) {
                    var cart = value.data ;
                    vue.cart = cart ;
                    var cartStr = JSON.stringify(cart);
                   /* alert(cartStr);*/

                })
                .catch(function (reason) {});
        },
        editCart:function (cartItem_ID,buycount) {
            axios({
                method:"POST",
                url:"cart.do",
                params:{
                    operate:'editcart',
                    cartItem_ID : cartItem_ID,
                    buyCount : buycount
                }
            })
                .then(function (value) {
                 vue.getCart();

                })
                .catch(function (reason) {});
        },
            delCart:function (cartItem_ID) {
                axios({
                    method:"POST",
                    url:"cart.do",
                    params:{
                        operate:'delcart',
                        cartItem_ID : cartItem_ID,
                    }
                })
                    .then(function (value) {
                        vue.getCart();

                    })
                    .catch(function (reason) {});
            },
            delallCart:function () {
                axios({
                    method:"POST",
                    url:"cart.do",
                    params:{
                        operate:'delallcart',
                    }
                })
                    .then(function (value) {
                        vue.getCart();

                    })
                    .catch(function (reason) {});
            }
        },
        beforeMount:
            function(){
                this.getCart() ;
            }
    });
}